package com.bookstore.tools;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * @Author Cofe
 * @Date 2022/5/9 23:08
 */
@Configuration
public class MultipartConfig {
    /**
     * 文件上传配置
     * @return
     */
    @Bean  //multipartresolver 文件上传解析
    public CommonsMultipartResolver multipartConfigElement() {
        CommonsMultipartResolver multipartresolver = new CommonsMultipartResolver();
        multipartresolver.setMaxUploadSize(1024*1024*5);
        multipartresolver.setDefaultEncoding("utf-8");
        return multipartresolver;
    }
}
